/*
 * CGetPutBuf.h
 *
 *  Created on: 2013. 6. 1.
 *      Author: khkim
 */


#ifndef CGETPUTBUF_H_
#define CGETPUTBUF_H_

#include <pthread.h>
#include "calist.h"
class CGetPutBuf {
private:
		lklist* mEmptyList;
		lklist* mFillList;
		char* mMem;
		int mElemNum;
		int mElemSize;
		pthread_mutex_t mMutex;

		// statics

public:
	CGetPutBuf(int nelem, int nsize);
	virtual ~CGetPutBuf();

	void* get_empty(bool force=true);
	void* get_fill();
	void put_empty(void* mem);
	void put_fill(void* mem);
	void clear_statics();
	void reset(void);
	
	int noFree;
	int noFill;
};

#endif /* CGETPUTBUF_H_ */
